<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test Jsonp</title>
    <script type="text/javascript">
        function jsonpCallback(data) {
            alert(data.msg);
        }
    </script>
</head>
<body>
    <h1> jsonp example</h1>
    <button onclick="jsonp('http://192.168.1.18:5500/jsonp.php')">click me for php</button>
    <br/>
    <button onclick="jsonp('http://192.168.1.18:5501/jsonp')">click me for golang</button>
    <br/>

    <script type="text/javascript">
        function jsonp(url) {
            var script = document.createElement('script');
            script.src = url + '?jsonp=jsonpCallback';
            document.head.appendChild(script);
        }
    </script>
</body>
</html>